﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UC_Giohang.ascx.cs" Inherits="Controls_UC_Giohang" %>
<div id="Breadcrumb">
    <ul>
        <li><a href="Trangchu.aspx">Trang chủ</a></li>
        <li>Giỏ hàng</li>
    </ul>
</div>
<div class="main-items">
    <div class="giohang">
        <h1>
            Thông tin giỏ hàng của bạn</h1>
        <br />
        <asp:GridView ID="gvGiohang" runat="server" AutoGenerateColumns="False" CellPadding="4"
            GridLines="None" ForeColor="#333333" CssClass="tbGiohang" OnRowCommand="gvGiohang_RowCommand">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:TemplateField HeaderText="Mã SP">
                    <ItemTemplate>
                        <asp:Label ID="lblIdSP" Text='<%#Eval("idSP") %>' runat="server" />
                    </ItemTemplate>
                    <ControlStyle Width="50px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên Sản Phẩm">
                    <ItemTemplate>
                        <a href='Chi-tiet-san-pham.aspx?Id=<%#Eval("idSp") %>'><asp:Label ID="Label1" Text='<%#Eval("TenSP") %>' runat="server" /></a>
                    </ItemTemplate>
                    <ControlStyle Width="200px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Đơn giá">
                    <ItemTemplate>
                        <asp:Label ID="Label2" Text='<%#dinhdangtien(Eval("Gia").ToString()) %>' runat="server" />
                    </ItemTemplate>
                    <ControlStyle Width="120px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Số lượng">
                    <ItemTemplate>
                        <%--<asp:Label ID="Label3" Text='<%#Eval("SoLuong") %>' runat="server" />--%>
                        <asp:TextBox Text='<%#Eval("SoLuong") %>' runat="server" CssClass="txtSoluong"
                            ID="txtSoLuong" Width="25" />
                    </ItemTemplate>
                     <ControlStyle Width="100px" />
                    
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Thành tiền">
                    <ItemTemplate>
                        <asp:Label ID="Label4" Text='<%#dinhdangtien(Eval("TongTien").ToString()) %>' runat="server" />
                    </ItemTemplate>
                    <ControlStyle Width="120px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="lbnXoa" runat="server" CommandArgument='<%#Eval("idSP") %>' CommandName="lbnXoa"
                            OnClientClick="if(confirm('Bạn có chắc xóa sản phẩm này không?')==false){	return false;	}">Xóa</asp:LinkButton>
                    </ItemTemplate>
                    <ControlStyle Width="50px" />
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" Height="40" Font-Size="14px" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <div class="thongbao">
        <asp:Literal ID="ltrThongbao" runat="server"></asp:Literal>
        </div>
        <div class="tongtien">
            <asp:Literal ID="ltrTongTien" runat="server"></asp:Literal>
        </div>
        <div class="button">
            <asp:Button ID="btnMuatiep" runat="server" Text="Mua Tiếp" OnClick="btnMuatiep_Click" />
            <asp:Button ID="btnXoagohang" runat="server" Text="Xóa Giỏ Hàng" OnClick="btnXoagohang_Click" />
            <asp:Button ID="btnCapnhat" runat="server" Text="Cập Nhật" OnClick="btnCapnhat_Click" />
            <asp:Button ID="btnDathang" runat="server" Text="Đặt Hàng" 
                OnClick="btnDathang_Click" CausesValidation="False" UseSubmitBehavior="False" />
        </div>
        <script type="text/javascript">

            function clickButton(e, buttonid) {
                var evt = e ? e : window.event;
                var bt = document.getElementById(buttonid);

                if (bt) {
                    if (evt.keyCode == 13) {
                        bt.click();
                        return false;
                    }
                }
            } 
        </script>
    </div>
</div>
